package com.googlecode.continuity.core.client;

import java.io.Serializable;

/**
 * ConfigurationEntry is a simple bean containing data of a configuration entry.
 *
 * @author Peter Schmitt <aragos@aragos.de>
 */
public class ConfigurationEntry implements Serializable {
// ------------------------------ FIELDS ------------------------------

  private String id;
  private String descriptionCode;
  private String value;
  private String format;

// --------------------- GETTER / SETTER METHODS ---------------------

  /**
   * Returns an i18n code for this configuration entry's description. The code can then be used to retrieve a
   * description message from an i18n message source.
   *
   * @return i18n message code for this entry's description
   */
  public String getDescriptionCode() {
    return descriptionCode;
  }

  /**
   * Sets an i18n code for this configuration entry's description. The code will then be used to retrieve a
   * description message from an i18n message source.
   *
   * @param descriptionCode i18n code for the description
   */
  public void setDescriptionCode(String descriptionCode) {
    this.descriptionCode = descriptionCode;
  }

  /**
   * Returns a string describing this configuration entry's value format.  The string can be used as a regular
   * expression.
   *
   * @return this configuration entry's value format
   */
  public String getFormat() {
    return format;
  }

  /**
   * Set a string describing this configuration entry's value format.  The string can be used as a regular
   * expression.
   *
   * @param format this configuration entry's value format
   */
  public void setFormat(String format) {
    this.format = format;
  }

  /**
   * Returns this configuration entry's unique id.
   *
   * @return this entry's id
   */
  public String getId() {
    return id;
  }

  /**
   * Sets a new unique id for this configuration entry.
   *
   * @param id new id
   */
  public void setId(String id) {
    this.id = id;
  }

  /**
   * Returns the value of this configuration entry.  The value has the format described by the configuration entry's
   * format field.
   *
   * @return configuration value
   * @see ConfigurationEntry#getFormat()
   */
  public String getValue() {
    return value;
  }

  /**
   * Sets a new value for this configuration entry.  The value <b>must</b> conform to the format given by this
   * configuration entry's format field
   *
   * @param value new configuration value
   * @see ConfigurationEntry#getFormat()
   */
  public void setValue(String value) {
    this.value = value;
  }
}
